<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var a = prompt("1.登录2.退出");
			// console.log(a);
			// console.log(typeof a); string
			// if (a == 1) { //隐式转换
			// prompt("请输入用户名");
			// }

			switch (a) {
				case "1":
					do {
						var flag = true;
						var name = prompt("请输入用户名");
						// console.log(name);
						var password = prompt("请输入密码");
						// console.log(password);
						if (name === "tom" && password === "123") {
							alert("欢迎使用学掌门");
							flag = false;
						}
					} while (flag);
					break;
				case "2":
					break;
			}
		</script>
	</head>
	<body>
	</body>
</html>
